/**
 * GroupsAction.java
 *
 * Copyright (c) 2009 Prj.Manager All Rights Reserved.
 *
 * This source file may not be copied, modified or redistributed,
 * in whole or in part, in any form or for any reason, without the express
 * written consent of Prj.Manager .
 **/
package ro.prjmanager.web.actions;

import ro.prjmanager.web.actions.GenericAction;
import ro.prjmanager.web.annotation.Service;
import ro.prjmanager.web.annotation.DefaultTargetMethod;
import ro.prjmanager.web.annotation.NomenclatorTarget;
import ro.prjmanager.core.annotations.Id;
import ro.prjmanager.core.annotations.Column;
import ro.prjmanager.core.annotations.EditOptions;
import ro.prjmanager.core.annotations.List;
import ro.prjmanager.service.GroupsService;
import ro.prjmanager.model.Groups;

@Service(target = "groupsService")
@NomenclatorTarget(addTarget = "add",deleteTarget = "del",editTarget = "edit",
        resource = "/pages/nomenclators/groups/groups.jsp",
        onFaildReturn = "/pages/nomenclators/groups/groups.jsp")
@List(serviceName = "groupsService",
        caption = "Groups List",
        editUrl = "%context_path%/actions/Groups.action",
        id = "1", height = 200, rowNum = 10,
        url = "%context_path%/groups.lst")
public class GroupsAction extends GenericAction<Groups> {

    @Id
    private Long idL;
    @Column(name = "name", caption = "NAME", index = "name", width = 400, editOptions = @EditOptions(pos = 2  ,cols = 20, rows = 4, edittype = "textarea" ))
    private java.lang.String name;

    @Column(name = "description", caption = "DESCRIPTION", index = "description", width = 400, editOptions = @EditOptions(pos = 3  ,cols = 20, rows = 4, edittype = "textarea" ))
    private java.lang.String description;

    public Long getIdL() {
        if(getId()!=null&&!getId().isEmpty()&&!getId().equals("_empty"))
          idL=Long.valueOf(getId());
        return idL;
    }

    public void setIdL(Long idL) {
        this.idL = idL;
        if(idL!=null)
            this.setId(String.valueOf(idL));
    }

    /**
     * This method gets the name attribute
     * @return - an  java.lang.String  object
     **/
    public  java.lang.String  getName(){
        return this.name;
    }

    /**
     * The setter for the name attribute
     * @param name -  an  java.lang.String  object
     **/
    public void setName( java.lang.String  name){
        this.name=name;
    }
    /**
     * This method gets the description attribute
     * @return - an  java.lang.String  object
     **/
    public  java.lang.String  getDescription(){
        return this.description;
    }

    /**
     * The setter for the description attribute
     * @param description -  an  java.lang.String  object
     **/
    public void setDescription( java.lang.String  description){
        this.description=description;
    }


    public void add() {
        Groups adderObj=getModel();
        getService().create(adderObj);

    }
    public void edit() {
         Groups editObj=getModel();
        getService().update(editObj);
    }



}
